package com.app.twth.ui.tally;


import com.app.twth.app.Constant;
import com.app.twth.base.BaseModel;
import com.app.twth.bean.BaseResponseEntity;
import com.app.twth.net.JsonCallBack;
import com.app.twth.utils.GsonUtil;
import com.lzy.okgo.OkGo;

public class TallyDataModel extends BaseModel {
    public <T> void getTallyList(int type, JsonCallBack jsonCallBack) {
        String url = Constant.tallyingContainers;
        if (type == 1) {
            url = Constant.talliedContainers;
        }
        OkGo.<BaseResponseEntity<T>>get(url)
                .tag(this)
                .execute(jsonCallBack);
    }

    public <T> void getTallyDetail(int id, JsonCallBack jsonCallBack) {
        OkGo.<BaseResponseEntity<T>>get(Constant.tallyDetail + id)
                .tag(this)
                .execute(jsonCallBack);
    }

    public <T> void getTallySkuDetail(int id, JsonCallBack jsonCallBack) {
        OkGo.<BaseResponseEntity<T>>get(Constant.tallySkuDetail + id)
                .tag(this)
                .execute(jsonCallBack);
    }

    public <T> void checkinSubmit(TallyCompletedQr receivingQr, JsonCallBack jsonCallBack) {
        OkGo.<BaseResponseEntity<T>>post(Constant.tallyCompleted)
                .tag(this)
                .upJson(GsonUtil.toJson(receivingQr))
                .execute(jsonCallBack);
    }

}